home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-07-28 | 1.1 KB | 54 lines | [TEXT/MPS ] |
- /*
- File: BufferDescriptor.cp
-
- Copyright: © 1991-1994 by Apple Computer, Inc.
- All rights reserved.
-
- Part of the AOCE Sample SMSAM Package. Consult the license
- which came with this software for your specific legal rights.
-
- */
-
-
-
- #ifndef __BUFFERDESCRIPTOR__
- #include "BufferDescriptor.h"
- #endif
-
- #ifndef __IOSTREAM__
- #include <iostream.h>
- #endif
-
- #ifndef __DEBUGGINGGEAR__
- #include "DebuggingGear.h"
- #endif
-
- TMailBuffer::TMailBuffer(long bufferSize) {
- fAllocatedBuffPtrWithNewPtr = true;
- fBuf.dataSize = 0;
- fBuf.buffSize = bufferSize;
- fBuf.buffPtr = FAILNewPtr (bufferSize);
- }
-
- TMailBuffer::TMailBuffer (long bufferSize, void *buffer, long dataSize) {
- fAllocatedBuffPtrWithNewPtr = false;
- fBuf.dataSize = dataSize;
- fBuf.buffSize = bufferSize;
- fBuf.buffPtr = (Ptr) buffer;
- }
-
- TMailBuffer::~TMailBuffer () {
- if (fAllocatedBuffPtrWithNewPtr && (fBuf.buffPtr))
- DeallocatePtr(fBuf.buffPtr);
- }
-
- void TMailBuffer::SetDataSize (long newDataSize) {
- if (newDataSize < 0)
- newDataSize = 0;
- if (newDataSize > BufferSize())
- newDataSize = BufferSize();
-
- fBuf.dataSize = newDataSize;
- }
-
-